﻿#region

using System;
using System.Windows.Forms;
using MidnightPeach.SolutionCreating;

#endregion

namespace MidnightPeach.Forms
{
    public partial class SolutionCreationForm : Form
    {
        public SolutionCreationForm()
        {
            InitializeComponent();
        }

        public string SolutionTemplate
        {
            get { return cbbTemplate.SelectedItem.ToString(); }
        }

        public string SolutionName
        {
            get { return txtSolutionName.Text; }
        }

        public string Directory
        {
            get { return txtFolder.Text; }
        }

        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            if (DesignMode)
                return;

            foreach (var directory in SolutionCreator.GetDirectoryNames())
                cbbTemplate.Items.Add(directory);

            cbbTemplate.SelectedIndex = 0;
        }

        private void btnBrowse_Click(object sender, EventArgs e)
        {
            if (fbdDialog.ShowDialog() == DialogResult.OK)
            {
                txtFolder.Text = fbdDialog.SelectedPath;
            }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtSolutionName.Text.Length > 0 && txtFolder.Text.Length > 0)
            {
                DialogResult = DialogResult.OK;
                Close();
            }
        }
    }
}